ostree.git
10 years agoRelease 2016.1
Colin Walters [Tue, 12 Jan 2016 13:55:06 +0000 (08:55 -0500)]
Release 2016.1

10 years agorepo: Add APIs for devino optimization between checkout -> commit
Colin Walters [Tue, 5 Jan 2016 14:13:54 +0000 (09:13 -0500)]
repo: Add APIs for devino optimization between checkout -> commit

A fast way to generate new OSTree content using an existing
tree is to checkout (as hard links), add/replace files, then
call `ostree_repo_scan_hardlinks()`, then commit.

But `ostree_repo_scan_hardlinks()` scans the entire repo, which
can be slow if you have a lot of content.

All we really need is a mapping of (device,inode) -> checksum
just for the objects we checked out, then use that mapping
for commits.

This patch adds API so that callers can create a mapping via
`ostree_repo_devino_cache_new()`, then pass it to
`ostree_repo_checkout_tree_at()` which will populate it, and then
`ostree_repo_write_directory_to_mtree()` can consume it.

I plan to use this in rpm-ostree for package layering work.

Notes:
 - The old `ostree_repo_scan_hardlinks()` API still works.
 - I tweaked the cache to be a set with the checksum colocated with
   the key, to avoid a separate malloc block per entry.

https://github.com/GNOME/ostree/pull/167

10 years agorepo: Expose dfd-relative mtree writes as public API
Colin Walters [Mon, 4 Jan 2016 22:51:56 +0000 (17:51 -0500)]
repo: Expose dfd-relative mtree writes as public API

For use in rpm-ostree.  We already had all of the internals for this.

10 years agogrub2_generate: load sysroot before using it
Jonathan Lebon [Thu, 24 Dec 2015 16:54:54 +0000 (11:54 -0500)]
grub2_generate: load sysroot before using it

The logic for checking which bootversion to use tries to access
sysroot->bootversion if the user didn't specify an explicit bootversion
on the command-line nor through the env var. However, at that point, the
sysroot object is not yet initialized, so it will always return 0, even
when it's 1.

This would cause e.g. `grub2-mkconfig` to have no output for the BLS
entries whenever the entries were under `/boot/loader.1`.

Related: RHBZ1293986

10 years agofetcher: Lazily create tmp directory
Matthew Barnes [Fri, 18 Dec 2015 15:50:08 +0000 (10:50 -0500)]
fetcher: Lazily create tmp directory

The tmp directory is lazily created for each fetcher instance, since
it may require superuser permissions and some instances only need
_ostree_fetcher_request_uri_to_membuf() which keeps everything in
memory buffers.

10 years agodeploy: Change large parts to be fd-relative, drop fsync
Colin Walters [Mon, 20 Apr 2015 19:51:24 +0000 (15:51 -0400)]
deploy: Change large parts to be fd-relative, drop fsync

This is a continuation of earlier work to drop the individual fsync on
files/directories in favor of relying on `syncfs()` for speed.

As part of that cleanup, I'm porting it to be fd-relative.

I feel relatively confident about this change given that this area of
the code has notable test suite coverage, although that code runs as
non-root.

10 years agobootconfig: Add ostree_bootconfig_parser_write_at
Colin Walters [Tue, 21 Apr 2015 02:23:39 +0000 (22:23 -0400)]
bootconfig: Add ostree_bootconfig_parser_write_at

This fd-relative API will be used by later libostree porting in the
deploy code path.

10 years agodeploy: Find kernel/initramfs consistently from filesystem
Colin Walters [Tue, 21 Apr 2015 02:02:14 +0000 (22:02 -0400)]
deploy: Find kernel/initramfs consistently from filesystem

I'm porting the deployment code to be fd-relative, but part of the
logic was using `GFile` to talk to `OstreeRepoFile` to determine the
"bootcsum" (boot config checksum) before checking out the file tree.

We can avoid having both code paths by checking out the tree first,
then looking at it on the filesystem.

10 years agotests: add tests for prune --static-deltas-only
Giuseppe Scrivano [Tue, 15 Dec 2015 10:52:24 +0000 (11:52 +0100)]
tests: add tests for prune --static-deltas-only

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoprune: add new flag --static-deltas-only
Giuseppe Scrivano [Tue, 15 Dec 2015 10:32:05 +0000 (11:32 +0100)]
prune: add new flag --static-deltas-only

When specified, only the static deltas files are pruned.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorepo: new function ostree_repo_prune_static_deltas
Giuseppe Scrivano [Tue, 15 Dec 2015 09:32:25 +0000 (10:32 +0100)]
repo: new function ostree_repo_prune_static_deltas

Extract existing code from ostree_repo_prune and add an argument COMMIT,
that controls which commit purge.  If not set, the old behavior is kept.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoremote: Add "ostree remote summary" command
Matthew Barnes [Wed, 16 Dec 2015 23:55:28 +0000 (18:55 -0500)]
remote: Add "ostree remote summary" command

Downloads and prints a remote summary file and any signatures in an
easy-to-read format, or alternatively with the --raw option, prints
the summary GVariant data directly.

https://bugzilla.gnome.org/show_bug.cgi?id=759250

10 years agorepo: Add ostree_repo_verify_summary()
Matthew Barnes [Wed, 16 Dec 2015 23:53:57 +0000 (18:53 -0500)]
repo: Add ostree_repo_verify_summary()

Verifies signatures on a summary -- both taken as GBytes inputs -- and
returns an OstreeGpgVerifyResult.

10 years agobuild: Fix srcdir != builddir
Colin Walters [Mon, 14 Dec 2015 19:19:35 +0000 (14:19 -0500)]
build: Fix srcdir != builddir

Caught by GContinuous.  Also change the file writes to be atomic,
otherwise we're not Ctrl-c safe.

10 years agopull: Push a temporary main context for sync requests
Matthew Barnes [Sat, 14 Nov 2015 01:37:13 +0000 (20:37 -0500)]
pull: Push a temporary main context for sync requests

Given the previous commit, which isolates SoupSession in a separate
thread, it should be safe to start pushing a temporary main context
for synchronous requests again.

This partially reverts 84fe2ff, which partially reverted 9f3d586.

Related to https://bugzilla.gnome.org/show_bug.cgi?id=753336

10 years agofetcher: Move the SoupSession to a separate thread
Matthew Barnes [Fri, 13 Nov 2015 20:44:20 +0000 (15:44 -0500)]
fetcher: Move the SoupSession to a separate thread

Move the SoupSession to a separate thread with its own isolated main
context and main loop.  All interaction with the SoupSession occurs
by way of idle sources attached to the session's main context, which
execute on the session's thread.

This should solve the problem of running an asynchronous fetch request
synchronously by pushing a new thread-default main context and iterating
a main loop until the request completes.  Prior to this, the new thread-
default main context would interfere with the SoupSession's own async
processing.

10 years agofetcher: Add "config-flags" construct-only property
Matthew Barnes [Tue, 10 Nov 2015 00:04:42 +0000 (19:04 -0500)]
fetcher: Add "config-flags" construct-only property

A lot of effort here just to avoid touching SoupSession directly in
ostree_fetcher_new().  The reason will become apparent in subsequent
commits.

Note this introduces generated enum/flags GTypes using glib-mkenums.
I could have just made the property type as plain integer, but doing
properties right will henceforth be easier now that the automake-fu
is established.

10 years agorepo: Allocate a tmpdir for each OstreeFetcher to isolate concurrent downloads
Alexander Larsson [Fri, 11 Dec 2015 18:30:20 +0000 (19:30 +0100)]
repo: Allocate a tmpdir for each OstreeFetcher to isolate concurrent downloads

This way two pulls will not use the same tmpdir and accidentally
overwrite each other. However, consecutive OstreeFetchers will reuse
the tmpdirs, so that we can properly resume downloading large objects.

https://bugzilla.gnome.org/show_bug.cgi?id=757611

10 years agorepo: Use per-transaction staging dir
Alexander Larsson [Fri, 11 Dec 2015 14:48:29 +0000 (15:48 +0100)]
repo: Use per-transaction staging dir

Concurrent pulls break since we're sharing the staging directory for
all transactions in the repo. This makes us use a per-transaction directory.

However, in order for resumes to work we first look for existing
staging directories and try to aquire an exclusive lock for them. If
we can't find any staging directory or they are all already locked,
then we create a new one.

https://bugzilla.gnome.org/show_bug.cgi?id=757611

10 years agorepo: Add _ostree_repo_allocate_tmpdir helper
Alexander Larsson [Fri, 11 Dec 2015 17:43:05 +0000 (18:43 +0100)]
repo: Add _ostree_repo_allocate_tmpdir helper

This creates a subdirectory of the tmp dir with a selected prefix,
and takes a lockfile to ensure that nobody else is using the same directory.
However, if a directory with the same prefix already exists and is
not locked that is used instead.

The later is useful if you want to support some kind of resumed operation
on the tmpdir.

touch reused dirs

https://bugzilla.gnome.org/show_bug.cgi?id=757611

10 years agoUpdate to latest libglnx
Alexander Larsson [Mon, 14 Dec 2015 07:37:17 +0000 (08:37 +0100)]
Update to latest libglnx

10 years agobuild: Also add a configure check for YACC/bison
Colin Walters [Mon, 7 Dec 2015 15:39:37 +0000 (10:39 -0500)]
build: Also add a configure check for YACC/bison

So we error out more nicely if not found.

10 years agobuild: Delete generated parse-datetime.c file, use AM_V_GEN
Colin Walters [Mon, 7 Dec 2015 15:33:23 +0000 (10:33 -0500)]
build: Delete generated parse-datetime.c file, use AM_V_GEN

Bison is a well known external dependency, so just require it.
Including the generated content in git means it may or may not
be regenerated based randomly on timestamps, etc.

Also use `$(AM_V_GEN)` so we get prettier output.

10 years agocmdline: Fatally error if the timestamp in a commit is invalid
Colin Walters [Fri, 4 Dec 2015 16:14:25 +0000 (11:14 -0500)]
cmdline: Fatally error if the timestamp in a commit is invalid

Previously we were just ignoring this, which hid a bug in
an earlier commit that generated them.

Also change the `commit` program to use both APIs - this
involves extra code, but not too much.

This way, reverting the fix with this on top caused the test suite to
fail.  Adding an active test for this would need a custom test program
using the C API, or adding a cmdline flag to the client, neither of
which quite seemed worth it.

10 years agotests: add missing ${CMD_PREFIX}
Giuseppe Scrivano [Wed, 25 Nov 2015 13:18:39 +0000 (14:18 +0100)]
tests: add missing ${CMD_PREFIX}

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoparse-datetime: use the module from gnulib
Giuseppe Scrivano [Wed, 25 Nov 2015 09:37:21 +0000 (10:37 +0100)]
parse-datetime: use the module from gnulib

Use the parse-datetime module from gnulib, and adapt it to not require
other modules as portability is not really an issue for us.

DATE can be specified in different formats, such as: "-1 week", "last
monday", "1 week ago".

Include the generated .c file in the repository so to not add another
dependency to Bison.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoRelease 2015.11
Colin Walters [Fri, 4 Dec 2015 14:53:03 +0000 (09:53 -0500)]
Release 2015.11

10 years agogpg-verifier: Fix compiler warning
Colin Walters [Fri, 4 Dec 2015 14:51:14 +0000 (09:51 -0500)]
gpg-verifier: Fix compiler warning

10 years agorepo: Fix backwards timestamp in ostree_repo_write_commit()
Matthew Barnes [Thu, 3 Dec 2015 17:01:38 +0000 (12:01 -0500)]
repo: Fix backwards timestamp in ostree_repo_write_commit()

ostree_repo_write_commit_with_time() converts the timestamp to
big-endian byte order.

ostree_repo_write_commit() was also doing this when calling
ostree_repo_write_commit_with_time(), resulting in a corrupted
commit object (timestamp bytes were backwards).

Recent regression in 14ffd7022a8c840f277c81e53864be4ea5fabacb

10 years agoremote: Print full refspec in "ostree remote refs"
Matthew Barnes [Wed, 2 Dec 2015 19:51:00 +0000 (14:51 -0500)]
remote: Print full refspec in "ostree remote refs"

Just to make copy-and-paste a little easier, as I often use this command
immediately before rebasing.

 e.g.

 # ostree remote refs fedora-atomic
 fedora-atomic:fedora-atomic/f23/x86_64/docker-host
 fedora-atomic:fedora-atomic/f23/x86_64/testing/docker-host
 ^^^^^^^^^^^^^^ (this part is new)

 # rpm-ostree rebase fedora-atomic:fedora-atomic/f23/x86_64/testing/docker-host

10 years agofetcher: Remove "total_requests" counter
Matthew Barnes [Fri, 13 Nov 2015 20:45:15 +0000 (15:45 -0500)]
fetcher: Remove "total_requests" counter

Incremented, but not used for anything.

10 years agofetcher: Remove "sending_messages" hash table
Matthew Barnes [Mon, 9 Nov 2015 20:30:24 +0000 (15:30 -0500)]
fetcher: Remove "sending_messages" hash table

Vestige of ostree_fetcher_query_state_text(), removed last year.

10 years agoglnx: Update from master
Matthew Barnes [Mon, 23 Nov 2015 19:49:06 +0000 (14:49 -0500)]
glnx: Update from master

More autocleanup backports, this time GFileOutputStream.

10 years agotrivial-httpd: Avoid SoupBuffer when there's no content
Matthew Barnes [Mon, 23 Nov 2015 19:29:03 +0000 (14:29 -0500)]
trivial-httpd: Avoid SoupBuffer when there's no content

This was supposed to be merged into the previous commit, but I
messed up.

10 years agorepo: Never delete .commitmeta files
Matthew Barnes [Mon, 23 Nov 2015 16:04:31 +0000 (11:04 -0500)]
repo: Never delete .commitmeta files

Do not delete a .commitmeta file after removing the last metadata entry.
This way a client will pull the empty .commitmeta file and overwrite old
metadata as expected.

https://bugzilla.gnome.org/750459

10 years agorepo: Validate checksums have correct length
Matthew Barnes [Tue, 17 Nov 2015 00:29:59 +0000 (19:29 -0500)]
repo: Validate checksums have correct length

ostree_checksum_bytes_peek() can return NULL if the checksum has an
incorrect length (most likely from disk corruption) but most callers
are not prepared to handle this and would likely crash.

Use ostree_checksum_bytes_peek_validate() instead, which sets a
GError on an invalid checksum.

10 years agotests: prefix invocation of ostree with where missing
Giuseppe Scrivano [Mon, 9 Nov 2015 12:03:35 +0000 (13:03 +0100)]
tests: prefix invocation of ostree with  where missing

And add a syntax rule to avoid this in future.

Fixed by:

sed -i -e 's|^ostree |${CMD_PREFIX} ostree |g' tests/*.sh

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotests: add tests for prune --keep-younger-than=DATE
Giuseppe Scrivano [Mon, 9 Nov 2015 11:07:16 +0000 (11:07 +0000)]
tests: add tests for prune --keep-younger-than=DATE

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agocommit: add --timestamp=TIMESTAMP
Giuseppe Scrivano [Mon, 9 Nov 2015 10:35:46 +0000 (10:35 +0000)]
commit: add --timestamp=TIMESTAMP

It allows to override the timestamp of the commit.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agolibostree: add new API ostree_repo_write_commit_with_time
Giuseppe Scrivano [Mon, 9 Nov 2015 10:16:55 +0000 (10:16 +0000)]
libostree: add new API ostree_repo_write_commit_with_time

It extends ostree_repo_write_commit as it permits to override the
commit timestamp.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoostree: do not print the usage on each G_IO_ERROR_NOT_SUPPORTED
Giuseppe Scrivano [Fri, 6 Nov 2015 11:06:26 +0000 (12:06 +0100)]
ostree: do not print the usage on each G_IO_ERROR_NOT_SUPPORTED

It may have a different meaning, and the usage screen is not helpful.

Print the usage screen only when the command is not found.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: make slightly clearer when failing for missing xattrs support
Giuseppe Scrivano [Fri, 6 Nov 2015 10:47:15 +0000 (11:47 +0100)]
pull: make slightly clearer when failing for missing xattrs support

It is not clear why pull fails on tmpfs.  The additional message might
be helpful.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoprune: add --keep-younger-than=DATE
Giuseppe Scrivano [Fri, 6 Nov 2015 08:50:17 +0000 (09:50 +0100)]
prune: add --keep-younger-than=DATE

The format used for DATE is "%Y-%m-%d %H:%M:%S %z"

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agotests: add test for ostree prune --delete-commit
Giuseppe Scrivano [Thu, 5 Nov 2015 12:34:00 +0000 (13:34 +0100)]
tests: add test for ostree prune --delete-commit

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agofsck: create a tombstone when the parent is missing
Giuseppe Scrivano [Thu, 5 Nov 2015 14:18:39 +0000 (15:18 +0100)]
fsck: create a tombstone when the parent is missing

Change the previous logic that a tombstone commit was created when
a partialcommit is found.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoprune: add --delete-commit
Giuseppe Scrivano [Thu, 5 Nov 2015 12:28:37 +0000 (13:28 +0100)]
prune: add --delete-commit

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agolibostree: Fix a couple compiler warnings
Matthew Barnes [Thu, 12 Nov 2015 19:32:07 +0000 (14:32 -0500)]
libostree: Fix a couple compiler warnings

10 years agodeltas: Support including detached metadata in static deltas
Alexander Larsson [Mon, 19 Oct 2015 08:10:50 +0000 (10:10 +0200)]
deltas: Support including detached metadata in static deltas

This is very useful for the inline-parts case, as you can then include
detached signatures in a single file representing the commit.

It is not as important for the generic pull case, as the detached
metadata is only a single small file. Additionally the detached
metadata is not content referenced and may change after the static
delta file was created, so we need to pull the latest version anyway.

10 years agopull: Verify checksums from static deltas unless gpg signed summary
Alexander Larsson [Mon, 19 Oct 2015 07:23:52 +0000 (09:23 +0200)]
pull: Verify checksums from static deltas unless gpg signed summary

Otherwise untrusted repos can lie about the commit ids.

10 years agodeltas: Support passing filename to ostree_repo_static_delta_execute_offline
Alexander Larsson [Fri, 16 Oct 2015 10:54:01 +0000 (12:54 +0200)]
deltas: Support passing filename to ostree_repo_static_delta_execute_offline

If you pass a diriectory it will look for the "superblock" child, otherwise
it will use the file as the superblock. I need this in xdg-app to be able
to install any filename as a bundle.

10 years agodeltas: Support passing filename to delta generator
Alexander Larsson [Fri, 16 Oct 2015 09:06:25 +0000 (11:06 +0200)]
deltas: Support passing filename to delta generator

10 years agodeltas: Make min-fallback-size 0 actually disable fallbacks
Alexander Larsson [Fri, 16 Oct 2015 09:03:53 +0000 (11:03 +0200)]
deltas: Make min-fallback-size 0 actually disable fallbacks

This is what the docs specify.

10 years agodeltas: Verify checksums in apply-offline unless skip_validate is TRUE
Alexander Larsson [Thu, 15 Oct 2015 17:36:30 +0000 (19:36 +0200)]
deltas: Verify checksums in apply-offline unless skip_validate is TRUE

10 years agoAdd _ostree_repo_open|commit_untrusted_content_bare
Alexander Larsson [Thu, 15 Oct 2015 17:34:04 +0000 (19:34 +0200)]
Add _ostree_repo_open|commit_untrusted_content_bare

Also renames OstreeRepoTrustedContentBareCommit to
OstreeRepoContentBareCommit so that it can be used by both.

This will be needed when we introduce checksum verification of objects
in static deltas.

10 years agostatic-delta apply-offline: Don't skip validation
Alexander Larsson [Thu, 15 Oct 2015 17:31:13 +0000 (19:31 +0200)]
static-delta apply-offline: Don't skip validation

This makes no sense, at least by default.

10 years agodelta: Ensure the from commit exists when applying static delta
Alexander Larsson [Thu, 15 Oct 2015 14:59:49 +0000 (16:59 +0200)]
delta: Ensure the from commit exists when applying static delta

10 years agodeltas: Make apply-offline only read the parts once
Alexander Larsson [Thu, 15 Oct 2015 13:54:35 +0000 (15:54 +0200)]
deltas: Make apply-offline only read the parts once

No need to read() the file for the checksum if we then directly mmap it.
Instead we just mmap it initially and checksum from that.

10 years agoAdd tests for inline static deltas
Alexander Larsson [Thu, 15 Oct 2015 08:46:16 +0000 (10:46 +0200)]
Add tests for inline static deltas

10 years agostatic-deltas generate: Add --inline option to CLI tool
Alexander Larsson [Thu, 10 Sep 2015 18:54:43 +0000 (20:54 +0200)]
static-deltas generate: Add --inline option to CLI tool

10 years agostatic deltas: Add support for inline-parts
Alexander Larsson [Thu, 10 Sep 2015 18:52:54 +0000 (20:52 +0200)]
static deltas: Add support for inline-parts

In this mode the parts are stored in the metadata of the main delta
superblock file.  This can be useful if you want a single-file delta
for easy transport, or for http in the case the delta is very small.

10 years agogenerate-static-delta: Support min-fallback-size 0 to disable fallbacks
Alexander Larsson [Thu, 10 Sep 2015 18:15:14 +0000 (20:15 +0200)]
generate-static-delta: Support min-fallback-size 0 to disable fallbacks

10 years agodocs: Note not to put private keys in /usr/share/ostree
Colin Walters [Sun, 8 Nov 2015 02:15:20 +0000 (21:15 -0500)]
docs: Note not to put private keys in /usr/share/ostree

https://bugzilla.gnome.org/show_bug.cgi?id=757524

10 years agotests: add tests for prune and tombstones commits
Giuseppe Scrivano [Wed, 28 Oct 2015 13:24:35 +0000 (14:24 +0100)]
tests: add tests for prune and tombstones commits

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agofsck: add argument --add-tombstones
Giuseppe Scrivano [Wed, 28 Oct 2015 13:23:35 +0000 (14:23 +0100)]
fsck: add argument --add-tombstones

It is used to create tombstones for missing commits

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agorepo: create a tombstone commit when deleting a commit
Giuseppe Scrivano [Wed, 28 Oct 2015 11:10:27 +0000 (12:10 +0100)]
repo: create a tombstone commit when deleting a commit

When a commit is deleted and the repo is configured to use tombstone
commits, create one.  Delete the tombstone file only if the commit is
pulled again.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agopull: add support for tombstone commits
Giuseppe Scrivano [Wed, 28 Oct 2015 09:07:51 +0000 (10:07 +0100)]
pull: add support for tombstone commits

Add a new object type: OSTREE_OBJECT_TYPE_TOMBSTONE_COMMIT that is
used when a commit was intentionally removed.

If the remote repository doesn't use tombstone commits, do not fail on
a missing commit (change 0b795785dd81cd1e8c2c5960f0959740bce72a51).

When the remote repository uses tombstones, if a commit cannot be
found, check if the tombstone file is present and fail if it is not
present.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agocore: use OSTREE_OBJECT_TYPE_LAST instead of OSTREE_OBJECT_TYPE_COMMIT
Giuseppe Scrivano [Wed, 28 Oct 2015 08:39:46 +0000 (09:39 +0100)]
core: use OSTREE_OBJECT_TYPE_LAST instead of OSTREE_OBJECT_TYPE_COMMIT

OSTREE_OBJECT_TYPE_LAST holds the value of the last element in the enum.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoinit-fs: Explicitly set /tmp to 01777
Colin Walters [Fri, 30 Oct 2015 21:10:23 +0000 (17:10 -0400)]
init-fs: Explicitly set /tmp to 01777

I think most people were using tmpfs-on-tmp and so didn't hit this.

See https://bugzilla.redhat.com/show_bug.cgi?id=1276775

10 years agosysroot: Write symlinks before calling fsync(), then rename after
Colin Walters [Tue, 13 Oct 2015 01:33:23 +0000 (21:33 -0400)]
sysroot: Write symlinks before calling fsync(), then rename after

There might be a race here in that we create new symlink files *after*
calling `syncfs`, and they are not guaranteed to end up on disk.

Rework the code so that we create symlinks before, and then only
rename them after (and `fsync()` the directory for good measure).

Additional-fixes-by: Giuseppe Scrivano <gscrivan@redhat.com>
Tested-by: Giuseppe Scrivano <gscrivan@redhat.com>
This still needs verification that we're fixing a real bug; but I'm
fairly confident this won't make the fsync situation worse.

https://bugzilla.gnome.org/show_bug.cgi?id=755595

10 years agostatic-delta: Fix annotation on ostree_repo_list_static_delta_names
John Hiesey [Wed, 21 Oct 2015 21:40:01 +0000 (14:40 -0700)]
static-delta: Fix annotation on ostree_repo_list_static_delta_names

out_deltas should be (transfer-container)

10 years agoprepare-root: set up /boot bind-mount for single partition systems
Daniel Drake [Tue, 21 Jul 2015 14:04:34 +0000 (08:04 -0600)]
prepare-root: set up /boot bind-mount for single partition systems

When booting from a system with /boot on the main partition, set up
an appropriate bind mount during boot. The ostree runtime binary
expects to be able to access the bootloader configs at /boot.

See: https://mail.gnome.org/archives/ostree-list/2015-July/msg00015.html

https://bugzilla.gnome.org/show_bug.cgi?id=756267

10 years agoupgrade: Add --override-commit=CHECKSUM option
Matthew Barnes [Tue, 6 Oct 2015 15:33:18 +0000 (11:33 -0400)]
upgrade: Add --override-commit=CHECKSUM option

Adds an entry to the origin file to force the OstreeSysrootUpgrader to
pull and deploy the given checksum.

  [origin]
  override-commit=CHECKSUM

If the option is not given, any such entry is explicitly removed from
the origin file to ensure we upgrade to the latest available commit.

10 years agoupgrader: Allow overriding the commit to pull
Matthew Barnes [Thu, 1 Oct 2015 23:02:11 +0000 (19:02 -0400)]
upgrader: Allow overriding the commit to pull

Upgrader now looks for an "override-commit" key in the origin file
with a commit checksum, which causes the upgrader to pull and deploy
the specified commit rather than the latest available commit on the
origin refspec.

10 years agoupgrader: Add ostree_sysroot_upgrader_dup_origin()
Matthew Barnes [Tue, 6 Oct 2015 15:24:23 +0000 (11:24 -0400)]
upgrader: Add ostree_sysroot_upgrader_dup_origin()

Convenience function returns a copy of the origin file, useful when
modifying it.

10 years agotests: fix LZMA test to really compress/decompress
Giuseppe Scrivano [Tue, 13 Oct 2015 10:40:09 +0000 (12:40 +0200)]
tests: fix LZMA test to really compress/decompress

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
10 years agoDon't require /boot/uEnv.txt for u-boot support
Gatis Paeglis [Tue, 6 Oct 2015 21:43:25 +0000 (23:43 +0200)]
Don't require /boot/uEnv.txt for u-boot support

The current code checks if /boot/uEnv.txt is a symlink to
decice if sysroot requires u-boot support. Why this is bad:

There are 2 ways to provide a custom env to u-boot from user space:

1) A compiled binary that is sourced from u-boot.
2) A text file (usually /uEnv.txt) that is imported into env from u-boot.

The current OSTree u-boot integration code was designed with the 1st
case in mind.

Many bootscripts provided by an embedded device vendors expect
to find uEnv.txt in the top level directory, it is often hardcoded
when building u-boot and is difficult to change later on. Or in other
cases it is stored in read-only memory so changing it would require
re-flushing boot loader with a new env. So the issue here is that
OSTree's and vendor uEnv.txt want to exist and the same path and OSTree
would throw away any changes added to /uEnv.txt by user on the next
upgrade/deploy.

This patch "hides" away the OSTree's env file loader/uEnv.txt from users
who are used to edditing uEnv.txt at the top level directory. Now to add
OSTree support on such boards you can simply add a custom logic in uEnv.txt
that loads ostree env from /loader/uEnv.txt

This change is backward compatible with the previous ostree releases and
solves the issue described in:

https://bugzilla.gnome.org/show_bug.cgi?id=755787

10 years agocommit: Improve variable name
Leandro Santiago [Fri, 9 Oct 2015 09:19:54 +0000 (11:19 +0200)]
commit: Improve variable name

Using `commit_subject` instead of `arg` is clearer as it can refer to
a directory, archive or ref.

This is just an aesthetic change in the source code, having no impact
anywhere else.

10 years agostatic-delta: Set error on bsdiff failure
John Hiesey [Fri, 2 Oct 2015 00:26:47 +0000 (17:26 -0700)]
static-delta: Set error on bsdiff failure

bsdiff can fail when generating static deltas, particularly if
not enough memory is available. Set error properly when this happens.

https://bugzilla.gnome.org/show_bug.cgi?id=756260

10 years agostatic-delta: Don't run bspatch when output object already exists
John Hiesey [Wed, 7 Oct 2015 21:43:13 +0000 (14:43 -0700)]
static-delta: Don't run bspatch when output object already exists

There is already a check that the destination object does not
exist in all other cases when processing an incoming static delta.
However, the bspatch case would still try to run and fail. Add
an analogous check to that case as well.

https://bugzilla.gnome.org/show_bug.cgi?id=756260

10 years agostatic-delta: Handle LZMA_BUF_ERROR returned by zlib
John Hiesey [Wed, 7 Oct 2015 20:30:33 +0000 (13:30 -0700)]
static-delta: Handle LZMA_BUF_ERROR returned by zlib

zlib can return LZMA_BUF_ERROR, which indicates that either
the input or output buffer has size zero. This case should cause
the correct error to be passed back from g_converter_convert
to expand the relevant buffer. Since this error is ambiguous
as to which buffer is too small, an explicit check on the
output buffer size is added as well.

https://bugzilla.gnome.org/show_bug.cgi?id=756260

10 years agotests: Add a test for pull+deploy of specific "bare" commit
Colin Walters [Wed, 23 Sep 2015 19:03:48 +0000 (15:03 -0400)]
tests: Add a test for pull+deploy of specific "bare" commit

This is the "pull an older version" that's now supported since
36d65b3cfcc9557552314d112493516437d6fcd4

https://github.com/GNOME/ostree/pull/145

10 years agodoc: Note that refs --delete does not prune
Colin Walters [Mon, 28 Sep 2015 19:49:12 +0000 (15:49 -0400)]
doc: Note that refs --delete does not prune

10 years agopull: Recover from missing commits in recursive pulls
Matthew Barnes [Thu, 24 Sep 2015 14:43:56 +0000 (10:43 -0400)]
pull: Recover from missing commits in recursive pulls

When traversing parents, do not fail on a missing commit.  We may
be pulling from a partial repository that ends in a dangling parent
reference.

10 years agosysroot: Cleanup refs and prune even on last undeployment
Colin Walters [Thu, 24 Sep 2015 15:00:54 +0000 (11:00 -0400)]
sysroot: Cleanup refs and prune even on last undeployment

I was working on a different test, and ended up being very confused at
the behavior where removing the last deployment didn't remove the last
`ostree/X/X/X` ref pointing to its commit.

There's no reason to special case the last undeployment AFAIK, and the
existing code handles this.

10 years agofetcher: Track outstanding requests with a table
Matthew Barnes [Wed, 23 Sep 2015 23:28:47 +0000 (19:28 -0400)]
fetcher: Track outstanding requests with a table

Track outstanding HTTP requests in a table for easier debugging.

Also fixes a bug discussed in https://bugzilla.gnome.org/755224
where the outstanding request counter was not decremented in the
event of an error, which could result in the fetcher hitting its
max request limit and locking up.

The bug is fixed by removing the request struct from the table in
pending_uri_free(), which is always called regardless of error,
so the outstanding request count is always accurate.

10 years agofetcher: Rework reference counting
Matthew Barnes [Wed, 23 Sep 2015 21:11:51 +0000 (17:11 -0400)]
fetcher: Rework reference counting

Have OstreeFetcherPendingURI be the GTask's task_data and pass the GTask
around in queues and callback closures.  The reference counting before
was a little confusing and this helps clarify it, at least to me.

OstreeFetcherPendingURI no longer needs its own reference count.

10 years agofetcher: Convert from GSimpleAsyncResult to GTask
Matthew Barnes [Wed, 23 Sep 2015 19:41:24 +0000 (15:41 -0400)]
fetcher: Convert from GSimpleAsyncResult to GTask

Obsessive compulsive cleanup.

10 years agofetcher: Remove message_to_request table
Matthew Barnes [Wed, 23 Sep 2015 17:24:41 +0000 (13:24 -0400)]
fetcher: Remove message_to_request table

Does not appear to be needed, no lookups on the table.

10 years agoRelease 2015.9
Colin Walters [Wed, 23 Sep 2015 16:10:22 +0000 (12:10 -0400)]
Release 2015.9

10 years agoRemove unused variables
Gatis Paeglis [Wed, 23 Sep 2015 10:46:06 +0000 (12:46 +0200)]
Remove unused variables

10 years agoMutable is a keyword in C++11
Leandro Santiago [Tue, 22 Sep 2015 11:52:29 +0000 (13:52 +0200)]
Mutable is a keyword in C++11

This fix allows including OSTree on C++ projects.

10 years agopull: Honor depth with OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY
Matthew Barnes [Mon, 21 Sep 2015 13:36:00 +0000 (09:36 -0400)]
pull: Honor depth with OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY

https://bugzilla.gnome.org/755224

10 years agorepo: Fix build without libsoup
Matthew Barnes [Mon, 21 Sep 2015 20:11:40 +0000 (16:11 -0400)]
repo: Fix build without libsoup

Had a rare situation where I had no libsoup development files, so I
took the opportunity to fix the build errors.  Ugly, but works now.

Would be nice if libsoup could be a hard dependency since we rarely
ever test a configuration without it.

10 years agoreset: Simplify argument checking logic
Matthew Barnes [Thu, 17 Sep 2015 16:25:37 +0000 (12:25 -0400)]
reset: Simplify argument checking logic

10 years agolibglnx: Update from master
Matthew Barnes [Wed, 16 Sep 2015 18:19:05 +0000 (14:19 -0400)]
libglnx: Update from master

Pick up PATH change for glnx_libcontainer_run_chroot_private().

10 years agodeploy: Do not prune repository
Matthew Barnes [Tue, 15 Sep 2015 18:40:18 +0000 (14:40 -0400)]
deploy: Do not prune repository

To support deploying older commits:

  ostree pull <remote> <checksum>
  ostree admin deploy <checksum>

Prior to this, the deploy command garbage collected <checksum> since
there's no ref pointing to it, and then ostree_sysroot_deploy_tree()
fails because it can't find the <checksum> commit.

https://bugzilla.gnome.org/732526

10 years agosysroot: Add ostree_sysroot_prepare_cleanup()
Matthew Barnes [Wed, 9 Sep 2015 18:50:14 +0000 (14:50 -0400)]
sysroot: Add ostree_sysroot_prepare_cleanup()

New public function works like ostree_sysroot_cleanup() EXCEPT FOR
pruning the repository.

Under the hood, add _ostree_sysroot_piecemeal_cleanup() which takes
flags to better control what files are cleaned up.  Both public cleanup
functions are now wrappers for _ostree_sysroot_piecemeal_cleanup() with
different flags.

10 years ago_ostree_static_delta_part_validate: Take a stream instead of a file as arg
Alexander Larsson [Thu, 10 Sep 2015 18:16:52 +0000 (20:16 +0200)]
_ostree_static_delta_part_validate: Take a stream instead of a file as arg

This is only called in one place, and we have already opened the file there,
no need to open it twice.

10 years agotests: Add a test for static-delta apply-offline
Colin Walters [Mon, 14 Sep 2015 01:35:10 +0000 (21:35 -0400)]
tests: Add a test for static-delta apply-offline

Obviously it was broken...

10 years agooffline delta apply: Handle the version field
Alexander Larsson [Thu, 10 Sep 2015 17:42:28 +0000 (19:42 +0200)]
offline delta apply: Handle the version field

It seems the format changed and this code was not updated.